#ifndef __SHT30_H__
#define __SHT30_H__

#include "bflb_i2c.h"
#include "bflb_gpio.h"
#include "bflb_mtimer.h"

#define  SHT30_ADDR                      0          /* SHT30的ADDR引脚电平逻辑值 */
#define  SHT30_TEST_MODE                 SHT30_CMD_MEAS_CLOCKSTR_H   /* SHT30测试模式选择 */   

#define SHT30_ADDR_L                     0x44       /* SHT30芯片IIC地址（ADDR为低电平） */
#define SHT30_ADDR_H                     0x45       /* SHT30芯片IIC地址（ADDR为高电平） */
#define SHT30_CMD_LEN_BYTE                2         /* SHT30芯片指令长度 */

/* SHT30支持的指令 */
typedef enum
{
	SHT30_CMD_MEAS_CLOCKSTR_H = 0,   
	SHT30_CMD_MEAS_CLOCKSTR_M,  
	SHT30_CMD_MEAS_CLOCKSTR_L, 
	SHT30_CMD_MEAS_POLLING_H,
	SHT30_CMD_MEAS_POLLING_M,
	SHT30_CMD_MEAS_POLLING_L,
	SHT30_CMD_MEAS_PERI_05_H,
	SHT30_CMD_MEAS_PERI_05_M,
	SHT30_CMD_MEAS_PERI_05_L,
	SHT30_CMD_MEAS_PERI_1_H,
	SHT30_CMD_MEAS_PERI_1_M,
	SHT30_CMD_MEAS_PERI_1_L,
	SHT30_CMD_MEAS_PERI_2_H,
	SHT30_CMD_MEAS_PERI_2_M,
	SHT30_CMD_MEAS_PERI_2_L,
	SHT30_CMD_MEAS_PERI_4_H,
	SHT30_CMD_MEAS_PERI_4_M,
	SHT30_CMD_MEAS_PERI_4_L,
	SHT30_CMD_MEAS_PERI_10_H,
	SHT30_CMD_MEAS_PERI_10_M,
	SHT30_CMD_MEAS_PERI_10_L,
	SHT30_CMD_FETCH_DATA,                /* 周期模式的读出测量 */
	SHT30_CMD_ART,                       /* ART（加速响应） */
	SHT30_CMD_STOP_PERI_DATA_ACQU,       /* 中断指令或采集数据 */
	SHT30_CMD_SOFT_RESET,                /* 软复位 */
	SHT30_CMD_RESET_THRO_PIN_NRESET,     /* 硬复位 */
	SHT30_CMD_HEATER_ENABLE,             /* 使能加热器 */
	SHT30_CMD_HEATER_DISABLE,            /* 关闭加热器 */
	SHT30_CMD_READ_STATUS,               /* 读取状态 */
	SHT30_CMD_CLEAR_STATUS,              /* 清除状态 */
	SHT30_CMD_LAST,
}SHT30CMD; 

/* SHT30指令发送结果 */
typedef enum
{
	SHT30_CMD_SEND_RESU_OK = 0,
	SHT30_CMD_SEND_RESU_ERR,
	SHT30_CMD_SEND_RESU_LAST,
}SHT30CMDSendResu;

/* SHT30温湿度读取结果 */
typedef enum
{
	SHT30_READ_OK = 0,
	SHT30_READ_ERR,
	SHT30_READ_LAST,
}SHT30ReadResu;

void SHT30_Init(); 
SHT30ReadResu SHT30_ReadTempAndHumi(float *_LuxVal);  
//SHT30ReadRes SHT30_TestModePoll(float *_LuxVal);
#endif